Technote TB 36 | November 1987 |
The interface to an MDEF is
PROCEDURE MyMDEF(message: Integer; theMenu: MenuHandle; VAR menuRect: Rect; hitPt: Point; VAR whichItem: Integer);
For mPopupMsg, the message parameter will be 3 and theMenu will be a MenuHandle to your menu. The MDEF should compute a rectangle for the menu such that the item passed in whichItem will be displayed at hitPt. See the figure below:
The hitPt parameter, though, is NOT a Point. Instead, this parameter is used to pass the top left of the item, passing the top coordinate and then the left coordinate. This is the opposite order of the fields in a Point. The values can be used together as a LongInt, with left in the high word and top in the low word, or separately as two Integers.
A more correct Pascal interface to the MDEF (for the mPopupMsg only) would be:
PROCEDURE MyMDEF(message: Integer; theMenu: MenuHandle; VAR menuRect: Rect; top, left: Integer; VAR whichItem: Integer);
Note: The MPW interface files incorrectly list mPopupMsg as 4; it should be 3.
Further Reference:
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help